Repository navigation
feat(k8s): the runtime sweep is discovery-driven, bounded by namespaces instead of kinds (#1517) - #1609
Merged
Conversation
…es instead of kinds (#1517) The runtime-children sweep bounded itself by kind: first Pods (#1077), then the estate's own declared API groups (#1518). Both miss where the runtime tier says the most — an operator's children are whatever kinds its controllers make, including kinds in groups the estate never declares (a CR's Deployments, a chain through a foreign CRD group), and no kind list can anticipate them. The sweep now asks the cluster itself. K8sClient gains preferredGroupVersions() — one groupVersion per served group, from the same cached root discovery servedGroupVersions reads — and the sweep lists every listable kind those serve. What bounds it is reach, not a table: - namespaced kinds are listed only in the namespaces the declared estate touches (owner references cannot cross a namespace); - cluster-scoped kinds are listed only when a declared cluster-scoped entity resolved (a cluster-scoped object's owners are cluster-scoped, Kubernetes' own GC rule); - Events are skipped: they name their subject via involvedObject, never ownerReferences, so listing them can only cost; - outside Pods, a swept object is still only reported when its owner chain (or the #1549 label channel) resolves to a declared entity — the sweep is not an inventory. Tri-state honesty extends to the sweep: a kind discovery names but the sweep cannot list (RBAC denial, a flaking apiserver) becomes a runtime-sweep:* entry in unobserved — recorded once per kind, naming the scopes that failed — never a silent gap that would read as "no runtime children there". A list 404 stays an absence, and declared resolution is never failed by the sweep. The k8s lexicon's optional client dependency moves to ^0.42.1 so the workspace client (which carries the new method) links instead of the published 0.41.20 nesting under lexicons/k8s.
This was referenced Aug 9, 2026
lex00
added a commit
that referenced
this pull request
Aug 9, 2026
… publish gate (#1616) The release recipe rewrites @intentius/* peerDependencies to the new version but left optionalDependencies alone, so lexicons/k8s kept @intentius/chant-k8s-client at ^0.42.1 across the 0.44.0 bump. Under 0.x semver that range excludes the workspace's 0.44.0, npm nests the published 0.42.1, and publish.yml's test job typechecks the lexicon against a client missing contextLabel (#1610) and preferredGroupVersions (#1609) — which is exactly how the chant-v0.44.0 publish run died before publishing anything. Pins the dep to ^0.44.0 now and teaches the recipe to rewrite @intentius/* optionalDependencies (a literal "*" stays untouched) so the next lockstep bump carries it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1517.
#1518 widened the #1077 Pod scan to the estate's own declared API groups, but the bound was still a kind list: children in groups the estate never declares — a CR's Deployments, anything an operator makes outside its own group — never surfaced as runtime children, and operator estates are exactly where the runtime tier matters most.
The sweep now inverts to discovery-driven, per the issue's direction:
K8sClientgainspreferredGroupVersions()— one groupVersion per served group (the group's ownpreferredVersion), derived from the same root discoveryservedGroupVersionsalready fetched, now shared through a single cached structure. One version per group means every kind is listed exactly once.involvedObject, neverownerReferences, so listing them can only cost.runtime-sweep:<gv>/<Kind>entry inunobservedwithclassifyApiFailure's own verdict (403 →no-credentials), recorded once per kind naming the scopes that failed. A list 404 stays an absence; declared-entity resolution is never failed by the sweep.The lexicon's optional dependency on
@intentius/chant-k8s-clientmoves to^0.42.1: the old^0.41.5range excluded the workspace's 0.42.1, so npm nested the published 0.41.20 underlexicons/k8sand the lexicon build typechecked against a client without the new method.Tests (fakeCluster-driven, no cluster contacted):
ownerChain: { root: "declared" }— the issue's own estate;runtime-sweep:batch/v1/Jobunobserved, never silence; same for the Pod list;k8s lexicon suite 63 files / 1282 passed; client suite passes with a new
preferredGroupVersionstest (preferred-per-group, fallback when a group reports none, cached root discovery);npm run buildgreen for both packages; eslint clean.